package cn.itsource.pethome.util;

public class AjaxResult {
    private Boolean success = true;
    private String msg = "操作成功";
    private Object data;

    //私有化构造方法
    private AjaxResult() {
    }

    //调用它来创建对象
    public static AjaxResult me(){
        return new AjaxResult();
    }

    public static AjaxResult error(){
        return me().setSuccess(false).setMsg("网络异常，请联系管理员！");
    }

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public AjaxResult setData(Object data) {
        this.data = data;
        return this;
    }

    public Boolean getSuccess() {
        return success;
    }

    public String getMsg() {
        return msg;
    }

    public Object getData() {
        return data;
    }
}
